package com.video.demo.controller;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Component
@EnableScheduling
public class ScheduledController {
    private final static long ONE_MINUTE = 60 * 1000;


    @Scheduled(fixedDelay = ONE_MINUTE)
    public void videoBack(){
                //录播开始时间
        Date parse = new Date();
        Calendar instance = Calendar.getInstance();
        instance.setTime(parse);

        int year = instance.get(Calendar.YEAR);//获取年份
        int month = instance.get(Calendar.MONTH);//获取月份 ;
        int day = instance.get(Calendar.DATE);//获取日

        //文件名  开始名字
        int hour = instance.get(Calendar.HOUR_OF_DAY);//时（24小时制）
        //文件名  结束名字
        int hour2 =hour+1;
        String videoName=hour+"-"+hour2+".flv";
        String minute = String.valueOf(instance.get(Calendar.MINUTE)+":"+instance.get(Calendar.SECOND));//分

        /**
         * /2020/7/13/11/11-12.flv
         */
        /**
         * /usr/local/src +省市县
         */

    }
}
